const webpack = require('webpack');
const path = require('path');
var ROOT_PATH = path.resolve(__dirname);
var LIB_PATH = path.resolve(ROOT_PATH, "app/lib");


// 资源依赖包，提前编译
const vendors = ['react', 'react-dom', 'react-router', 'redux', 'react-redux', 'react-router-redux', 'redux-actions', 'redux-promise', 'axios', 'antd'];

module.exports = {
  entry: {
    vendors
  },
  output: {
    path: LIB_PATH,
    filename: '[name].js',
    library: '[name]_library',
  },
  plugins: [
    new webpack.DllPlugin({
      path: path.resolve(LIB_PATH, '[name]-manifest.json'),
      name: '[name]_library',
      context: __dirname,
    })
  ]
};